package com.jocund.quicktest;

import java.util.Date;

public class User extends Object{
	
	public User(){
		this.lastReportedTime = new Date();
	}
	
	private String friendlyName;
	public void setFriendlyName(String value){
		this.friendlyName = value;
	}
	public String getFriendlyName(){
		return this.friendlyName;
	}
	
	private String uniqueName;
	public void setUniqueName(String value){
		this.uniqueName = value;
	}
	public String getUniqueName(){
		return this.uniqueName;
	}
	
	private boolean isOnline;
	public void setIsOnline(boolean value){
		this.isOnline = value;
	}
	public boolean getIsOnline(){
		return this.isOnline;
	}
	
	private Date lastReportedTime;
	public Date getLastReportedTime(){
		return this.lastReportedTime;
	}
	
	public void reportOnline(){
		this.lastReportedTime = new Date();
		this.isOnline = true;
	}
	
	@Override
	public int hashCode(){
		return this.uniqueName.hashCode();
	}
	
	@Override
	public boolean equals(Object obj){
		if (obj == null)
			return false;
		if (!(obj instanceof User))
			return false;
		
		return this.uniqueName.equals(((User)obj).uniqueName);
	}
}
